/**
 * 
 */
package com.kelaite.procurement.constants;

import com.kelaite.procurement.exception.BusinessException;

/**
 * @author yuanchangwei
 *
 */
public enum MilestoneTypeEnum {

	PRE_FIRST_PAY(1, "已付头款"),

	FIRST_PAY(2, "一阶段"),

	SECOND_PAY(3, "二阶段"),

	THIRD_PAY(4, "三阶段"),

	FOURTH_PAY(5, "四阶段");

	private int val;

	private String desc;

	private MilestoneTypeEnum(int val, String desc) {

		this.val = val;
		this.desc = desc;
	}

	public int getVal() {

		return val;
	}

	public void setVal(int val) {

		this.val = val;
	}

	public String getDesc() {

		return desc;
	}

	public void setDesc(String desc) {

		this.desc = desc;
	}

	public static MilestoneTypeEnum parse(int val) {

		for (MilestoneTypeEnum entity : values()) {
			if (entity.getVal() == val) {
				return entity;
			}
		}
		throw new BusinessException(String.format(
				"MilestoneTypeEnum's val[%s] is illegal. ", val));
	}
}
